package com.test.webtest.controller;

import com.test.webtest.service.FileCleanupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/cleanup")
public class FileCleanupController {

    @Autowired
    private FileCleanupService fileCleanupService;

    /**
     * 手动触发清理接口
     * @param days 超过days天未修改的文件
     * @return
     */
    @PostMapping("/trigger")
    public boolean triggerCleanup(@RequestParam long days) {
        return fileCleanupService.manualCleanup(days);
    }
}